Missing data from /schedules/{id}/users for time ranges far into the future

We’re trying to determine which users are on-call for certain schedules. For that, we query https://api.pagerduty.com/schedules/{id}/users with the given schedule ID and pass the since and until parameters.

If the time range extends more than ~3 months into the future, the call returns only users from the first 3 months. If the time range starts ~3 months into the future and ends ~6 months into the future, no users are returned at all.

Is there any limitation on the since and until fields for the https://api.pagerduty.com/schedules/{id}/users endpoint?

Thanks!
Peter

Hello Peter,

The parameters since and until pull on the oncall shifts which are limited to 90 days, which comes to about 3 months, roughly. So yeah, that is the limitation.
You will find more details about that here.

Kind regards,

Hi Chiedu,

Thanks for checking it out.

On the UI, via “People” > “On-Call Schedules”, I can see the schedule for years to come. Is that data available in the API somewhere?

Best regards,
Peter

Hello Peter,

There is a limit when it comes to the API hence the parameters being introduced. This would make for easy of use for all customers and reduce the load on the API.

I hope that helps.

Kind regards,

Hi,

A solution will be to check date with after and before method. If is required to consider inclusive endDate, testDate.before(endDate) returns false when testDate and endDate are the same day, we can use “apache commons lang” package to verify this (org.apache.commons.lang.time.DateUtils)

import org.apache.commons.lang.time.DateUtils;

boolean isWithinRange(Date testDate) {
    return   testDate.after(startDate) && (testDate.before(endDate) || DateUtils.isSameDay(testDate, endDate));
}

Regards - Java Classes